import vitePluginCompression from 'vite-plugin-compression';
import { PluginOption } from 'vite';
export const setupCompress = (): PluginOption => {
	// @ts-ignore
	return vitePluginCompression({
		ext                : '.gz',
		algorithm          : 'gzip',
		threshold          : 1024,
		deleteOriginFile   : false,
		verbose            : false,
		disable            : false,
		compressionOptions : {
			level : 9
		},
		// /\.js$|\.css$|\.json$|\.woff2$|\.woff$|\.ttf$|\.svg$|\.eot$/
		filter : /\.js$|\.css$|\.json$|\.woff2$|\.woff$|\.ttf$|\.svg$|\.eot$/
		// success : (): void => console.log('资源压缩完毕,点击爆炸')
	});
};